home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Light ROM 1
/
LIGHT-ROM 1 (Amiga Library Services)(1994).iso
/
ffdisks
/
d880.lha
/
Oberon
/
O3Demo2.lzh
/
Examples
/
ConcurrencyDemo.mod
< prev
next >
Wrap
Text File
|
1993-01-15
|
2KB
|
108 lines
MODULE ConcurrencyDemo;
IMPORT C := Concurrency,
B := BasicTypes,
E := Exec,
I := Intuition,
D := Display;
VAR p: C.Process;
TYPE
Window = POINTER TO WindowDesc;
WindowDesc = RECORD (B.ANYDesc)
x,y,w,h: INTEGER;
END;
VAR w: Window;
PROCEDURE New(w: B.ANY): B.ANY;
VAR
win: D.WindowPtr;
i,top: INTEGER;
msg: E.MessagePtr;
fertig: BOOLEAN;
PROCEDURE NewProcess;
VAR
new: Window;
BEGIN
NEW(new);
new.x := win.window.leftEdge + 20; new.w := win.window.width;
new.y := win.window.topEdge + 20; new.h := win.window.height;
IF C.NewProcess(New,new)=NIL THEN END;
END NewProcess;
BEGIN
WITH w: Window DO
NEW(win);
IF D.OpenWindow(win,"Neuer Prozeß",w.x,w.y,w.w,w.h,NIL) THEN
I.OldModifyIDCMP(win.window,LONGSET{I.closeWindow,I.newSize,I.vanillaKey});
top := win.rp.font.ySize;
fertig := FALSE;
REPEAT
D.FrontPen(win,1);
D.Jam1(win);
D.Home(win);
D.Write(win,"Taste <S> startet noch einen Prozeß!");
D.Complement(win);
msg := NIL;
WHILE msg=NIL DO
i := 0;
WHILE (i<=win.width-2) & (msg=NIL) DO
D.Line(win,0,top,win.width-1-i,win.height-1);
D.Line(win,win.width-1-i,top,win.width-1,win.height-1);
msg := E.GetMsg(win.window.userPort);
INC(i,2);
END;
END;
IF msg#NIL THEN
WITH msg: I.IntuiMessage DO
IF I.newSize IN msg.class THEN
D.Init(win); D.Clear(win);
ELSIF I.vanillaKey IN msg.class THEN
IF CAP(CHR(msg.code))="S" THEN NewProcess END;
ELSIF I.closeWindow IN msg.class THEN
fertig := TRUE;
END;
E.ReplyMsg(msg);
END;
END;
UNTIL fertig;
D.Close(win);
END; (* IF D.OpenWindow(..) END; *)
END; (* WITH w: Window DO *)
RETURN NIL;
END New;
BEGIN
NEW(w);
w.x := 0;
w.y := 0;
w.w := 320;
w.h := 70;
p := C.NewProcess(New,w);
CLOSE
C.WaitForAllProcesses;
END ConcurrencyDemo.